use "busactivity_rep.dta", clear

svyset [weight=teamweight]


***Support for free markets (bivariate)***
twoway histogram Market_Efficient if party3==1, discrete fcolor(gs1%50) lcolor(gs1%50) lpattern(dash) || histogram Market_Efficient if party3==2, discrete fcolor(gs13%50) lcolor(gs13%50)   || histogram Market_Efficient if party3==3, discrete fcolor(gs6%50) lcolor(gs6%50) lpattern(dot)  legend(order(1 "Democratic" 2 "Independent" 3 "Republican") rows(1)) scheme(sj) graphregion(color(white))
graph save freemarket_single_hist.gph, replace


***Support for free markets (multivariate)***
svy: ologit Market_Efficient party7 religiosity family_income age i2.race3 hispanic2 gender_m
eststo Market_Efficient

ologit Market_Efficient party7 religiosity family_income age i2.race3 hispanic2 gender_m [pweight=teamweight]

coefplot Market_Efficient, xline(0) drop(_cons) scheme(s1mono) 
graph save marketscoef.gph, replace

esttab Market_Efficient using "freemarkets_reg_table.tex", se r2 scalars(chi2) starlevels($^+$ 0.1 $^*$ 0.05 $^{**}$ 0.01) label replace


***Support for business leaders(bivariate)***
twoway histogram business_trust if party3==1, discrete fcolor(gs1%50) lcolor(gs1%50) lpattern(dash) || histogram business_trust if party3==2, discrete fcolor(gs13%50) lcolor(gs13%50) || histogram business_trust if party3==3, discrete fcolor(gs6%50) lcolor(gs6%50) lpattern(dot) legend(order(1 "Democratic" 2 "Independent" 3 "Republican") rows(1)) scheme(sj) graphregion(color(white)) title(Trust Business Leaders) xtitle("") ylabel(0 (.25) 0.75) xlabel(1 "None At All" 2 "Not Very Much" 3 "A Good Deal" 4 "A Great Deal") name(business1, replace) 

twoway histogram business_govern if party3==1, discrete fcolor(gs1%50) lcolor(gs1%50) lpattern(dash) || histogram business_govern if party3==2, discrete fcolor(gs13%50) lcolor(gs13%50) || histogram business_govern if party3==3, discrete fcolor(gs6%50) lcolor(gs6%50) lpattern(dot) legend(order(1 "Democratic" 2 "Independent" 3 "Republican") rows(1)) scheme(sj) graphregion(color(white)) title(Business Leaders Govern) xtitle("") ylabel(0 (.25) 0.75) xlabel(1 "Very Bad" 2 "Bad" 3 "Good" 4 "Very Good") name(business2, replace) 

twoway histogram business_role if party3==1, discrete fcolor(gs1%50) lcolor(gs1%50) lpattern(dash) || histogram business_role if party3==2, discrete fcolor(gs13%50) lcolor(gs13%50) || histogram business_role if party3==3, discrete fcolor(gs6%50) lcolor(gs6%50) lpattern(dot) legend(order(1 "Democratic" 2 "Independent" 3 "Republican") rows(1)) scheme(sj) graphregion(color(white)) title(Business Leaders Better) xtitle("") ylabel(0 (.25) 0.75) xlabel(1 "Str. Disagree" 2 "Disagree" 3 "Neither" 4 "Agree" 5 "Str. Agree") name(business3, replace) 

twoway histogram BusinessLeaders if party3==1, width(.3333) fcolor(gs1%50) lcolor(gs1%50) lpattern(dash) || histogram BusinessLeaders if party3==2, width(.3333) fcolor(gs13%50) lcolor(gs13%50) || histogram BusinessLeaders if party3==3, width(.3333) fcolor(gs6%50) lcolor(gs6%50) lpattern(dot) legend(order(1 "Democratic" 2 "Independent" 3 "Republican") rows(1)) scheme(sj) graphregion(color(white)) title(Business Leader Index) xtitle("") ylabel(0 (.25) 0.75) name(business4, replace) 

grc1leg business1 business2 business3 business4, graphregion(color(white))
graph save businesscombined.gph, replace


***Support for business leaders(multivariate)***
svy: ologit business_trust c.Market_Efficient##c.party7 religiosity family_income age i2.race3 hispanic2 gender_m
eststo biztrust
svy: ologit business_govern c.Market_Efficient##c.party7 religiosity family_income age i2.race3 hispanic2 gender_m
eststo bizgov
svy: ologit business_role c.Market_Efficient##c.party7 religiosity family_income age i2.race3 hispanic2 gender_m
eststo bizrole
svy: reg BusinessLeaders c.Market_Efficient##c.party7 religiosity family_income age i2.race3 hispanic2 gender_m
eststo bizleaders

coefplot biztrust || bizgov || bizrole || bizleaders, xline(0) drop(_cons) scheme(s1mono) bylabels("Business Trust" "Business Govern" "Business Role" "Business Leader Index") coeflabels(c.FMI#c.party7="FMI X Party ID") legend(order(2 "Additive Model" 4 "Interaction Model"))
graph save businesscoef.gph, replace

esttab biztrust bizgov bizrole bizleaders using "busleader_int_table.tex", se r2 scalars(chi2) starlevels($^+$ 0.1 $^*$ 0.05 $^{**}$ 0.01) label replace

*Additive models for appendix
svy: ologit business_trust c.Market_Efficient c.party7 religiosity family_income age i2.race3 hispanic2 gender_m
eststo biztrust2
svy: ologit business_govern c.Market_Efficient c.party7 religiosity family_income age i2.race3 hispanic2 gender_m
eststo bizgov2
svy: ologit business_role c.Market_Efficient c.party7 religiosity family_income age i2.race3 hispanic2 gender_m
eststo bizrole2
svy: reg BusinessLeaders c.Market_Efficient c.party7 religiosity family_income age i2.race3 hispanic2 gender_m
eststo bizleaders2

ologit business_role c.Market_Efficient c.party7 religiosity family_income age i2.race3 hispanic2 gender_m [pweight=teamweight]

esttab biztrust2 bizgov2 bizrole2 bizleaders2 using "busleader_noint_table.tex", se r2 scalars(chi2) starlevels($^+$ 0.1 $^*$ 0.05 $^{**}$ 0.01) label replace


***Plot predicted level of support for business leaders and marginal effect of FMI***
histogram BusinessLeaders
svy: reg BusinessLeaders c.Market_Efficient##c.party7 religiosity family_income age i2.race3 hispanic2 gender_m
margins, at(Market_Efficient=(1 (1) 5) party7=(1 7))
marginsplot, recast(line) recastci(rarea) scheme(sj) graphregion(color(white)) plot1opts(lpattern(-.)) legend(order(3 "Strong Democrat" 4 "Strong Republican")) ytitle("") title("") ylabel(1 (.5) 3.5)
svy: reg BusinessLeaders c.Market_Efficient##c.party7 religiosity family_income age i2.race3 hispanic2 gender_m
margins, dydx(Market_Efficient) at(party7=(1 (0.1) 7)) 
marginsplot, recast(line) recastci(rarea) scheme(sj) graphregion(color(white)) ylabel(0 (0.1) 0.5) yline(0, lc(red)) ytitle("") xtitle("Party Identification (1 = Strong Democrat, 7 = Strong Republican)") title("Marginal Effect of Free Market Attitudes on Support for Business Leaders", size(normal)) xlabel(1 (1) 7)


***Support for CEO advocacy (bivariate)***
twoway histogram TAM147 if party3==1, discrete fcolor(gs1%50) lcolor(gs1%50) lpattern(dash)  || histogram TAM147 if party3==2, discrete fcolor(gs13%50) lcolor(gs13%50) || histogram TAM147 if party3==3, discrete fcolor(gs6%50) lcolor(gs6%50) lpattern(dot) legend(order(1 "Democratic" 2 "Independent" 3 "Republican") rows(1)) scheme(sj) graphregion(color(white)) title(Issues They Care About) xtitle("") ylabel(0 (.25) 0.75) xlabel(1 "Yes" 2 "No" 3 "Don't Know") name(ceo1, replace) 

twoway histogram TAM148 if party3==1, discrete fcolor(gs1%50) lcolor(gs1%50) lpattern(dash) || histogram TAM148 if party3==2, discrete fcolor(gs13%50) lcolor(gs13%50) || histogram TAM148 if party3==3, discrete fcolor(gs6%50) lcolor(gs6%50) lpattern(dot) legend(order(1 "Democratic" 2 "Independent" 3 "Republican") rows(1)) scheme(sj) graphregion(color(white)) title(Issues Help Company Financially) xtitle("") ylabel(0 (.25) 0.75) xlabel(1 "Yes" 2 "No" 3 "Don't Know") name(ceo2, replace) 

grc1leg ceo1 ceo2, graphregion(color(white))
graph save ceocombinedRR.gph, replace


***Support for CEO advocacy (multivariate)***
logit CEO_IssueCare c.Market_Efficient c.party7 religiosity family_income age i2.race3 hispanic2 gender_m [pweight=teamweight]
eststo CEO_IssueCare
logit CEO_IssueProfit c.Market_Efficient c.party7 religiosity family_income age i2.race3 hispanic2 gender_m [pweight=teamweight]
eststo CEO_IssueProfit

coefplot CEO_IssueCare || CEO_IssueProfit, xline(0) drop(_cons) scheme(s1mono) bylabels("Cares About Issue" "Issue Helps Company") coeflabels(c.FMI#c.party7="FMI X Party ID")
graph save ceocoef.gph, replace

esttab CEO_IssueCare CEO_IssueProfit using "ceo_reg_table.tex", se r2 scalars(chi2 r2_p) starlevels($^+$ 0.1 $^*$ 0.05 $^{**}$ 0.01) label replace

logit CEO_IssueCare c.Market_Efficient##c.party7 religiosity family_income age i2.race3 hispanic2 gender_m [pweight=teamweight]
eststo CEO_IssueCare2

logit CEO_IssueProfit c.Market_Efficient##c.party7 religiosity family_income age i2.race3 hispanic2 gender_m  [pweight=teamweight]
eststo CEO_IssueProfit2

esttab CEO_IssueCare2 CEO_IssueProfit2 using "ceo_alt_table.tex", se r2 scalars(chi2 r2_p) starlevels($^+$ 0.1 $^*$ 0.05 $^{**}$ 0.01) label replace

